package com.example.onlinemusic.mapper;

import com.example.onlinemusic.model.Music;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface MusicMapper {
    public int insert(String title, String singer, String time,String url, int userid);

    @Select("select * from music where title=#{s} and singer=#{singer}")
    Music selectByName(String s, String singer);

    @Select("select * from music where id = #{id}")
    Music selectById(int id);

    @Delete("delete from music where id = #{musicId}")
    int deleteMusicById(int musicId);

    @Select("select * from music")
    List<Music> findMusic();

    @Select("select * from music where title like concat('%',#{musicName},'%')")
    List<Music> findMusicByName(String musicName);
}
